<?php
########################################################################################
# Empresa :     Tecnopac Informatica;                                                  #
# Autor:        Deiverson Pacheco;                                                     #
# Data Criação: 10/12/2010;                                                            #
########################################################################################
session_start();
header("Cache-control: private");
include_once("../../includes/session.php");


//Linha para formatação de caracteres com acentuação
header("Content-Type: text/html; charset=ISO-8859-1",true);


//======================================================================================
//==> Include obrigatórias no script
//======================================================================================
include_once('../../includes/classes/class.TemplatePower.php');
include_once('../../includes/classes/class.Conexao.php');
include_once('../../includes/classes/class.Geral.php');
include_once('../../includes/classes/class.Upload.php');


//======================================================================================
//==> Inicializar Classes
//======================================================================================
$not  = new Persist;
$not5 = new Persist;
$data = new getData;
$cor  = new ColorTr;
$util = new Util;
$vld  = new ValidarDados;
$sql  = new SqlInjection;


//======================================================================================
//==> Instanciar TemplatePower para juntar o PHP + HTML
//======================================================================================
$tpl  = new TemplatePower('../../html/estoque/popup_produtos_fotos.html');
$tpl->prepare();


//======================================================================================
//==> Recebe variaveis de pesquisa
//======================================================================================

$id  = @$_GET['id'];

$tpl->assign('id_cad',$id);

$cont = 1;

$not->sql = "select arquivo, legenda, id, id_produto, ordem ,mostra_site
from fotos_produtos
where id_produto = '$id' order by ordem asc";

if($not->ler()>0){
	while($not->ini()){
		
		$tpl->newBlock('LOOP');
		$tpl->assign('cont',$cont);
		$cont++;
		$tpl->assign('par_id', $not->id);
		$tpl->assign('nome', $not->legenda . ($not->mostra_site == 1 ? " [Site] ":""));
	
		$tpl->assign('imagem',"<img src='../../gera_imagem.php?evento=LoadThumb&url=fotos/$id/$not->arquivo&w=50&h=50'>");
		
		$tpl->assign('ordem', $not->ordem);
		$tpl->assign('cor', $cor->altColor());
	}
}
$tpl->goToBlock('_ROOT');



//======================================================================================
//==> Enviar página unificada PHP + HTML
//======================================================================================
$tpl->showUnAssigned( false );  // para debug. na hora de publicar, setar para false
$tpl->printToScreen();
?>